(0) Obligation:
Runtime Complexity TRS:
The TRS R consists of the following rules:
sort(l) → st(0, l)
st(n, l) → cond1(member(n, l), n, l)
cond1(true, n, l) → cons(n, st(s(n), l))
cond1(false, n, l) → cond2(gt(n, max(l)), n, l)
cond2(true, n, l) → nil
cond2(false, n, l) → st(s(n), l)
member(n, nil) → false
member(n, cons(m, l)) → or(equal(n, m), member(n, l))
or(x, true) → true
or(x, false) → x
equal(0, 0) → true
equal(s(x), 0) → false
equal(0, s(y)) → false
equal(s(x), s(y)) → equal(x, y)
gt(0, v) → false
gt(s(u), 0) → true
gt(s(u), s(v)) → gt(u, v)
max(nil) → 0
max(cons(u, l)) → if(gt(u, max(l)), u, max(l))
if(true, u, v) → u
if(false, u, v) → v
Rewrite Strategy: INNERMOST
(1) RenamingProof (EQUIVALENT transformation)
Renamed function symbols to avoid clashes with predefined symbol.
(2) Obligation:
Runtime Complexity Relative TRS:
The TRS R consists of the following rules:
sort(l) → st(0', l)
st(n, l) → cond1(member(n, l), n, l)
cond1(true, n, l) → cons(n, st(s(n), l))
cond1(false, n, l) → cond2(gt(n, max(l)), n, l)
cond2(true, n, l) → nil
cond2(false, n, l) → st(s(n), l)
member(n, nil) → false
member(n, cons(m, l)) → or(equal(n, m), member(n, l))
or(x, true) → true
or(x, false) → x
equal(0', 0') → true
equal(s(x), 0') → false
equal(0', s(y)) → false
equal(s(x), s(y)) → equal(x, y)
gt(0', v) → false
gt(s(u), 0') → true
gt(s(u), s(v)) → gt(u, v)
max(nil) → 0'
max(cons(u, l)) → if(gt(u, max(l)), u, max(l))
if(true, u, v) → u
if(false, u, v) → v
S is empty.
Rewrite Strategy: INNERMOST
(3) TypeInferenceProof (BOTH BOUNDS(ID, ID) transformation)
Infered types.
(4) Obligation:
Innermost TRS:
Rules:
sort(l) → st(0', l)
st(n, l) → cond1(member(n, l), n, l)
cond1(true, n, l) → cons(n, st(s(n), l))
cond1(false, n, l) → cond2(gt(n, max(l)), n, l)
cond2(true, n, l) → nil
cond2(false, n, l) → st(s(n), l)
member(n, nil) → false
member(n, cons(m, l)) → or(equal(n, m), member(n, l))
or(x, true) → true
or(x, false) → x
equal(0', 0') → true
equal(s(x), 0') → false
equal(0', s(y)) → false
equal(s(x), s(y)) → equal(x, y)
gt(0', v) → false
gt(s(u), 0') → true
gt(s(u), s(v)) → gt(u, v)
max(nil) → 0'
max(cons(u, l)) → if(gt(u, max(l)), u, max(l))
if(true, u, v) → u
if(false, u, v) → v
Types:
sort :: cons:nil → cons:nil
st :: 0':s → cons:nil → cons:nil
0' :: 0':s
cond1 :: true:false → 0':s → cons:nil → cons:nil
member :: 0':s → cons:nil → true:false
true :: true:false
cons :: 0':s → cons:nil → cons:nil
s :: 0':s → 0':s
false :: true:false
cond2 :: true:false → 0':s → cons:nil → cons:nil
gt :: 0':s → 0':s → true:false
max :: cons:nil → 0':s
nil :: cons:nil
or :: true:false → true:false → true:false
equal :: 0':s → 0':s → true:false
if :: true:false → 0':s → 0':s → 0':s
hole_cons:nil1_0 :: cons:nil
hole_0':s2_0 :: 0':s
hole_true:false3_0 :: true:false
gen_cons:nil4_0 :: Nat → cons:nil
gen_0':s5_0 :: Nat → 0':s
(5) OrderProof (LOWER BOUND(ID) transformation)
Heuristically decided to analyse the following defined symbols:
st,
member,
gt,
max,
equalThey will be analysed ascendingly in the following order:
member < st
gt < st
max < st
equal < member
gt < max
(6) Obligation:
Innermost TRS:
Rules:
sort(
l) →
st(
0',
l)
st(
n,
l) →
cond1(
member(
n,
l),
n,
l)
cond1(
true,
n,
l) →
cons(
n,
st(
s(
n),
l))
cond1(
false,
n,
l) →
cond2(
gt(
n,
max(
l)),
n,
l)
cond2(
true,
n,
l) →
nilcond2(
false,
n,
l) →
st(
s(
n),
l)
member(
n,
nil) →
falsemember(
n,
cons(
m,
l)) →
or(
equal(
n,
m),
member(
n,
l))
or(
x,
true) →
trueor(
x,
false) →
xequal(
0',
0') →
trueequal(
s(
x),
0') →
falseequal(
0',
s(
y)) →
falseequal(
s(
x),
s(
y)) →
equal(
x,
y)
gt(
0',
v) →
falsegt(
s(
u),
0') →
truegt(
s(
u),
s(
v)) →
gt(
u,
v)
max(
nil) →
0'max(
cons(
u,
l)) →
if(
gt(
u,
max(
l)),
u,
max(
l))
if(
true,
u,
v) →
uif(
false,
u,
v) →
vTypes:
sort :: cons:nil → cons:nil
st :: 0':s → cons:nil → cons:nil
0' :: 0':s
cond1 :: true:false → 0':s → cons:nil → cons:nil
member :: 0':s → cons:nil → true:false
true :: true:false
cons :: 0':s → cons:nil → cons:nil
s :: 0':s → 0':s
false :: true:false
cond2 :: true:false → 0':s → cons:nil → cons:nil
gt :: 0':s → 0':s → true:false
max :: cons:nil → 0':s
nil :: cons:nil
or :: true:false → true:false → true:false
equal :: 0':s → 0':s → true:false
if :: true:false → 0':s → 0':s → 0':s
hole_cons:nil1_0 :: cons:nil
hole_0':s2_0 :: 0':s
hole_true:false3_0 :: true:false
gen_cons:nil4_0 :: Nat → cons:nil
gen_0':s5_0 :: Nat → 0':s
Generator Equations:
gen_cons:nil4_0(0) ⇔ nil
gen_cons:nil4_0(+(x, 1)) ⇔ cons(0', gen_cons:nil4_0(x))
gen_0':s5_0(0) ⇔ 0'
gen_0':s5_0(+(x, 1)) ⇔ s(gen_0':s5_0(x))
The following defined symbols remain to be analysed:
gt, st, member, max, equal
They will be analysed ascendingly in the following order:
member < st
gt < st
max < st
equal < member
gt < max
(7) RewriteLemmaProof (LOWER BOUND(ID) transformation)
Proved the following rewrite lemma:
gt(
gen_0':s5_0(
n7_0),
gen_0':s5_0(
n7_0)) →
false, rt ∈ Ω(1 + n7
0)
Induction Base:
gt(gen_0':s5_0(0), gen_0':s5_0(0)) →RΩ(1)
false
Induction Step:
gt(gen_0':s5_0(+(n7_0, 1)), gen_0':s5_0(+(n7_0, 1))) →RΩ(1)
gt(gen_0':s5_0(n7_0), gen_0':s5_0(n7_0)) →IH
false
We have rt ∈ Ω(n1) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n).
(8) Complex Obligation (BEST)
(9) Obligation:
Innermost TRS:
Rules:
sort(
l) →
st(
0',
l)
st(
n,
l) →
cond1(
member(
n,
l),
n,
l)
cond1(
true,
n,
l) →
cons(
n,
st(
s(
n),
l))
cond1(
false,
n,
l) →
cond2(
gt(
n,
max(
l)),
n,
l)
cond2(
true,
n,
l) →
nilcond2(
false,
n,
l) →
st(
s(
n),
l)
member(
n,
nil) →
falsemember(
n,
cons(
m,
l)) →
or(
equal(
n,
m),
member(
n,
l))
or(
x,
true) →
trueor(
x,
false) →
xequal(
0',
0') →
trueequal(
s(
x),
0') →
falseequal(
0',
s(
y)) →
falseequal(
s(
x),
s(
y)) →
equal(
x,
y)
gt(
0',
v) →
falsegt(
s(
u),
0') →
truegt(
s(
u),
s(
v)) →
gt(
u,
v)
max(
nil) →
0'max(
cons(
u,
l)) →
if(
gt(
u,
max(
l)),
u,
max(
l))
if(
true,
u,
v) →
uif(
false,
u,
v) →
vTypes:
sort :: cons:nil → cons:nil
st :: 0':s → cons:nil → cons:nil
0' :: 0':s
cond1 :: true:false → 0':s → cons:nil → cons:nil
member :: 0':s → cons:nil → true:false
true :: true:false
cons :: 0':s → cons:nil → cons:nil
s :: 0':s → 0':s
false :: true:false
cond2 :: true:false → 0':s → cons:nil → cons:nil
gt :: 0':s → 0':s → true:false
max :: cons:nil → 0':s
nil :: cons:nil
or :: true:false → true:false → true:false
equal :: 0':s → 0':s → true:false
if :: true:false → 0':s → 0':s → 0':s
hole_cons:nil1_0 :: cons:nil
hole_0':s2_0 :: 0':s
hole_true:false3_0 :: true:false
gen_cons:nil4_0 :: Nat → cons:nil
gen_0':s5_0 :: Nat → 0':s
Lemmas:
gt(gen_0':s5_0(n7_0), gen_0':s5_0(n7_0)) → false, rt ∈ Ω(1 + n70)
Generator Equations:
gen_cons:nil4_0(0) ⇔ nil
gen_cons:nil4_0(+(x, 1)) ⇔ cons(0', gen_cons:nil4_0(x))
gen_0':s5_0(0) ⇔ 0'
gen_0':s5_0(+(x, 1)) ⇔ s(gen_0':s5_0(x))
The following defined symbols remain to be analysed:
max, st, member, equal
They will be analysed ascendingly in the following order:
member < st
max < st
equal < member
(10) RewriteLemmaProof (EQUIVALENT transformation)
Proved the following rewrite lemma:
max(
gen_cons:nil4_0(
n372_0)) →
gen_0':s5_0(
0), rt ∈ Ω(2
n)
Induction Base:
max(gen_cons:nil4_0(0)) →RΩ(1)
0'
Induction Step:
max(gen_cons:nil4_0(+(n372_0, 1))) →RΩ(1)
if(gt(0', max(gen_cons:nil4_0(n372_0))), 0', max(gen_cons:nil4_0(n372_0))) →IH
if(gt(0', gen_0':s5_0(0)), 0', max(gen_cons:nil4_0(n372_0))) →LΩ(1)
if(false, 0', max(gen_cons:nil4_0(n372_0))) →IH
if(false, 0', gen_0':s5_0(0)) →RΩ(1)
gen_0':s5_0(0)
We have rt ∈ Ω(2n) and sz ∈ O(n). Thus, we have ircR ∈ Ω(2n)
(11) BOUNDS(2^n, INF)
(12) Obligation:
Innermost TRS:
Rules:
sort(
l) →
st(
0',
l)
st(
n,
l) →
cond1(
member(
n,
l),
n,
l)
cond1(
true,
n,
l) →
cons(
n,
st(
s(
n),
l))
cond1(
false,
n,
l) →
cond2(
gt(
n,
max(
l)),
n,
l)
cond2(
true,
n,
l) →
nilcond2(
false,
n,
l) →
st(
s(
n),
l)
member(
n,
nil) →
falsemember(
n,
cons(
m,
l)) →
or(
equal(
n,
m),
member(
n,
l))
or(
x,
true) →
trueor(
x,
false) →
xequal(
0',
0') →
trueequal(
s(
x),
0') →
falseequal(
0',
s(
y)) →
falseequal(
s(
x),
s(
y)) →
equal(
x,
y)
gt(
0',
v) →
falsegt(
s(
u),
0') →
truegt(
s(
u),
s(
v)) →
gt(
u,
v)
max(
nil) →
0'max(
cons(
u,
l)) →
if(
gt(
u,
max(
l)),
u,
max(
l))
if(
true,
u,
v) →
uif(
false,
u,
v) →
vTypes:
sort :: cons:nil → cons:nil
st :: 0':s → cons:nil → cons:nil
0' :: 0':s
cond1 :: true:false → 0':s → cons:nil → cons:nil
member :: 0':s → cons:nil → true:false
true :: true:false
cons :: 0':s → cons:nil → cons:nil
s :: 0':s → 0':s
false :: true:false
cond2 :: true:false → 0':s → cons:nil → cons:nil
gt :: 0':s → 0':s → true:false
max :: cons:nil → 0':s
nil :: cons:nil
or :: true:false → true:false → true:false
equal :: 0':s → 0':s → true:false
if :: true:false → 0':s → 0':s → 0':s
hole_cons:nil1_0 :: cons:nil
hole_0':s2_0 :: 0':s
hole_true:false3_0 :: true:false
gen_cons:nil4_0 :: Nat → cons:nil
gen_0':s5_0 :: Nat → 0':s
Lemmas:
gt(gen_0':s5_0(n7_0), gen_0':s5_0(n7_0)) → false, rt ∈ Ω(1 + n70)
Generator Equations:
gen_cons:nil4_0(0) ⇔ nil
gen_cons:nil4_0(+(x, 1)) ⇔ cons(0', gen_cons:nil4_0(x))
gen_0':s5_0(0) ⇔ 0'
gen_0':s5_0(+(x, 1)) ⇔ s(gen_0':s5_0(x))
No more defined symbols left to analyse.
(13) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n1) was proven with the following lemma:
gt(gen_0':s5_0(n7_0), gen_0':s5_0(n7_0)) → false, rt ∈ Ω(1 + n70)
(14) BOUNDS(n^1, INF)